home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
src
/
X11
/
tclMotif-1.4
/
programs
/
prog75
< prev
next >
Wrap
Text File
|
1995-06-29
|
1KB
|
51 lines
proc listSelectedItems {} {
.form.list getValues \
-selectedItems i -selectedItemCount n
return "$n $i"
}
proc indexToY {w n} {
# calculate the Y co-ord for an index in the list
$w getValues \
-height h -itemCount count \
-visibleItemCount vis
set y [expr {(2*$n - 1) * $h / (2*$count)}]
return $y
}
proc buttonPress {w n} {
# simulate a button press
return [$w callActionProc ListBeginSelect() \
-type ButtonPress \
-x 0 -y [indexToY $w $n]]
}
proc buttonRelease {w n} {
# simulate a button release
return [$w callActionProc ListEndSelect() \
-type ButtonRelease \
-x 0 -y [indexToY $w $n]]
}
xtAppInitialize
xmRowColumn .form managed
xmList .form.list2 managed \
-items "a b c d" -itemCount 4 \
-visibleItemCount 4
.form.list2 setValues -selectionPolicy multiple_select -selectedItems "" -selectedItemCount 0
buttonPress .form.list2 2
buttonRelease .form.list2 2
buttonPress .form.list2 3
set ans [buttonRelease .form.list2 3]
puts stdout "selected: $ans"
. realizeWidget
. mainLoop